<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
<head th:include="public/page_css::page_css ('选择提取条数')"/>

<body>
<div class="layui-fluid larry-wrapper">
    <div class="layui-card">
        <div class="layui-row layui-col-space30">
            <div class="layui-col-xs24">
                <input type="hidden" th:value="${id}" id="kid">
                <section class="panel panel-padding layui-card-body">
                    <div class="pro">
                        <table id="table3" class="table text-nowrap"></table>
                    </div>
                </section>
            </div>
        </div>
    </div>
</div>
</body>
<div th:include="public/public_js::public_js"></div>

<script th:inline="javascript">
    $(function () {

    })

</script>
<script>
    var $table;
    var xx_number = 0;
    layui.use(['myform', 'zzpUtils', 'form', 'jquery'], function () {

        var zzpUtils = layui.zzpUtils,
            $ = layui.jquery;


        $table = zzpUtils.table({
            elem: '#table3',
            isApi: true,
            pagination: true,
            showColumns: false, //是否显示所有的列
            queryParams: queryParams,
            url: '/wmsEstimatedArrivalOrder/getPoDetailed',
            columns: [{
                field: '',
                checkbox: true
            },{
                field: 'zongshu',
                title: '判断数量',
                visible: false
            }, {
                field: 'hpbh',
                title: '货品编号'
            }, {
                field: 'hpmc',
                title: '货品名称'
            }, {
                field: 'bzmc',
                title: '单位'
            }, {
                field: 'yqsl',
                title: '主单位（点击编辑数量）',
                editable: {
                    type: 'text',
                    clear: false,
                    validate: function (value) {
                        if (isNaN(value)) return {newValue: 1, msg: '只允许输入数字'};
                        else if (value <= 0) return {newValue: 1, msg: '不能输入负数或0'};
                        else if (value <= xx_number) return {newValue: value};
                        else if (value > xx_number) return {newValue: xx_number};
                    },
                }
            }, {
                field: 'xdwsl',
                title: '箱单位'
            }],
            onClickRow: function (row, $element, field) {
                xx_number = row.zongshu;
            },
        });

        function queryParams(params) {
            var temp = {   //这里的键的名字和控制器的变量名必须一直，这边改动，控制器也需要改成一样的
                sscgdid: $("#kid").val()
            };
            return temp;
        };


    });

    //父页面调用子页面专用
    function sureChoose() {
        var rows = $table.bootstrapTable('getSelections');
        var sscgdid = $("#kid").val();
        var array = [];
        var pass = {};
        pass.rows = rows;
        pass.sscgdid = sscgdid;
        array.push(pass);
        return array;
    }

</script>
</html>